using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._DataManagementTools._Fields
{
    /// <summary>
    /// <para>Add Field</para>
    /// <para>Adds a new field to a table or the table of a feature class or feature layer, as well as to rasters with attribute tables.</para>
    /// <para>将新字段添加到表或要素类或要素图层的表中，以及具有属性表的栅格中。</para>
    /// </summary>    
    [DisplayName("Add Field")]
    public class AddField : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public AddField()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_table">
        /// <para>Input Table</para>
        /// <para><xdoc>
        ///   <para>The input table to which the specified field will be added. The field will be added to the existing input table and will not create a new output table.</para>
        ///   <para>Fields can be added to feature classes in geodatabases, shapefiles, coverages, stand-alone tables, raster catalogs, rasters with attribute tables, and layers.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将添加指定字段的输入表。该字段将添加到现有输入表中，并且不会创建新的输出表。</para>
        ///   <para>可以将字段添加到地理数据库、shapefile、coverage、独立表、栅格目录、带属性表的栅格和图层中的要素类。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_field_name">
        /// <para>Field Name</para>
        /// <para>The name of the field that will be added to the input table.</para>
        /// <para>将添加到输入表中的字段的名称。</para>
        /// </param>
        /// <param name="_field_type">
        /// <para>Field Type</para>
        /// <para><xdoc>
        ///   <para>Specifies the field type of the new field.</para>
        ///   <bulletList>
        ///     <bullet_item>Text—Any string of characters.</bullet_item><para/>
        ///     <bullet_item>Float (single precision)— Fractional numbers between -3.4E38 and 1.2E38.</bullet_item><para/>
        ///     <bullet_item>Double (double precision)— Fractional numbers between -2.2E308 and 1.8E308.</bullet_item><para/>
        ///     <bullet_item>Short (small integer)— Whole numbers between -32,768 and 32,767.</bullet_item><para/>
        ///     <bullet_item>Long (large integer)— Whole numbers between -2,147,483,648 and 2,147,483,647.</bullet_item><para/>
        ///     <bullet_item>Date—Date and/or time.</bullet_item><para/>
        ///     <bullet_item>Blob (binary data)—Long sequence of binary numbers. You need a custom loader or viewer or a third-party application to load items into a BLOB field or view the contents of a BLOB field.</bullet_item><para/>
        ///     <bullet_item>Raster imagery—Raster images. All ArcGIS software-supported raster dataset formats can be stored, but it is highly recommended that only small images be used.</bullet_item><para/>
        ///     <bullet_item>GUID (globally unique identifier)—Globally unique identifier.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定新字段的字段类型。</para>
        ///   <bulletList>
        ///     <bullet_item>文本 - 任意字符串。</bullet_item><para/>
        ///     <bullet_item>浮点数（单精度）— 介于 -3.4E38 和 1.2E38 之间的小数。</bullet_item><para/>
        ///     <bullet_item>双精度（双精度）— 介于 -2.2E308 和 1.8E308 之间的小数。</bullet_item><para/>
        ///     <bullet_item>短（小整数）— -32,768 和 32,767 之间的整数。</bullet_item><para/>
        ///     <bullet_item>长整数（大整数）— 介于 -2,147,483,648 和 2,147,483,647 之间的整数。</bullet_item><para/>
        ///     <bullet_item>日期 - 日期和/或时间。</bullet_item><para/>
        ///     <bullet_item>Blob（二进制数据）- 二进制数的长序列。您需要自定义加载程序或查看器或第三方应用程序才能将项目加载到 BLOB 字段或查看 BLOB 字段的内容。</bullet_item><para/>
        ///     <bullet_item>栅格影像 - 栅格影像。可以存储所有 ArcGIS 软件支持的栅格数据集格式，但强烈建议仅使用小型影像。</bullet_item><para/>
        ///     <bullet_item>GUID（全局唯一标识符）- 全局唯一标识符。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// </param>
        public AddField(object _in_table, object _field_name, _field_type_value _field_type)
        {
            this._in_table = _in_table;
            this._field_name = _field_name;
            this._field_type = _field_type;
        }
        public override string ToolboxName => "Data Management Tools";

        public override string ToolName => "Add Field";

        public override string CallName => "management.AddField";

        public override List<string> AcceptEnvironments => ["workspace"];

        public override object[] ParameterInfo => [_in_table, _field_name, _field_type.GetGPValue(), _field_precision, _field_scale, _field_length, _field_alias, _field_is_nullable.GetGPValue(), _field_is_required.GetGPValue(), _field_domain, _out_table];

        /// <summary>
        /// <para>Input Table</para>
        /// <para><xdoc>
        ///   <para>The input table to which the specified field will be added. The field will be added to the existing input table and will not create a new output table.</para>
        ///   <para>Fields can be added to feature classes in geodatabases, shapefiles, coverages, stand-alone tables, raster catalogs, rasters with attribute tables, and layers.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将添加指定字段的输入表。该字段将添加到现有输入表中，并且不会创建新的输出表。</para>
        ///   <para>可以将字段添加到地理数据库、shapefile、coverage、独立表、栅格目录、带属性表的栅格和图层中的要素类。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_table { get; set; }


        /// <summary>
        /// <para>Field Name</para>
        /// <para>The name of the field that will be added to the input table.</para>
        /// <para>将添加到输入表中的字段的名称。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Field Name")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _field_name { get; set; }


        /// <summary>
        /// <para>Field Type</para>
        /// <para><xdoc>
        ///   <para>Specifies the field type of the new field.</para>
        ///   <bulletList>
        ///     <bullet_item>Text—Any string of characters.</bullet_item><para/>
        ///     <bullet_item>Float (single precision)— Fractional numbers between -3.4E38 and 1.2E38.</bullet_item><para/>
        ///     <bullet_item>Double (double precision)— Fractional numbers between -2.2E308 and 1.8E308.</bullet_item><para/>
        ///     <bullet_item>Short (small integer)— Whole numbers between -32,768 and 32,767.</bullet_item><para/>
        ///     <bullet_item>Long (large integer)— Whole numbers between -2,147,483,648 and 2,147,483,647.</bullet_item><para/>
        ///     <bullet_item>Date—Date and/or time.</bullet_item><para/>
        ///     <bullet_item>Blob (binary data)—Long sequence of binary numbers. You need a custom loader or viewer or a third-party application to load items into a BLOB field or view the contents of a BLOB field.</bullet_item><para/>
        ///     <bullet_item>Raster imagery—Raster images. All ArcGIS software-supported raster dataset formats can be stored, but it is highly recommended that only small images be used.</bullet_item><para/>
        ///     <bullet_item>GUID (globally unique identifier)—Globally unique identifier.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定新字段的字段类型。</para>
        ///   <bulletList>
        ///     <bullet_item>文本 - 任意字符串。</bullet_item><para/>
        ///     <bullet_item>浮点数（单精度）— 介于 -3.4E38 和 1.2E38 之间的小数。</bullet_item><para/>
        ///     <bullet_item>双精度（双精度）— 介于 -2.2E308 和 1.8E308 之间的小数。</bullet_item><para/>
        ///     <bullet_item>短（小整数）— -32,768 和 32,767 之间的整数。</bullet_item><para/>
        ///     <bullet_item>长整数（大整数）— 介于 -2,147,483,648 和 2,147,483,647 之间的整数。</bullet_item><para/>
        ///     <bullet_item>日期 - 日期和/或时间。</bullet_item><para/>
        ///     <bullet_item>Blob（二进制数据）- 二进制数的长序列。您需要自定义加载程序或查看器或第三方应用程序才能将项目加载到 BLOB 字段或查看 BLOB 字段的内容。</bullet_item><para/>
        ///     <bullet_item>栅格影像 - 栅格影像。可以存储所有 ArcGIS 软件支持的栅格数据集格式，但强烈建议仅使用小型影像。</bullet_item><para/>
        ///     <bullet_item>GUID（全局唯一标识符）- 全局唯一标识符。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Field Type")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public _field_type_value _field_type { get; set; }

        public enum _field_type_value
        {
            /// <summary>
            /// <para>Text</para>
            /// <para>Text—Any string of characters.</para>
            /// <para>文本 - 任意字符串。</para>
            /// </summary>
            [Description("Text")]
            [GPEnumValue("TEXT")]
            _TEXT,

            /// <summary>
            /// <para>Float (single precision)</para>
            /// <para>Float (single precision)— Fractional numbers between -3.4E38 and 1.2E38.</para>
            /// <para>浮点数（单精度）— 介于 -3.4E38 和 1.2E38 之间的小数。</para>
            /// </summary>
            [Description("Float (single precision)")]
            [GPEnumValue("FLOAT")]
            _FLOAT,

            /// <summary>
            /// <para>Double  (double precision)</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("Double  (double precision)")]
            [GPEnumValue("DOUBLE")]
            _DOUBLE,

            /// <summary>
            /// <para>Short (small integer)</para>
            /// <para>Short (small integer)— Whole numbers between -32,768 and 32,767.</para>
            /// <para>短（小整数）— -32,768 和 32,767 之间的整数。</para>
            /// </summary>
            [Description("Short (small integer)")]
            [GPEnumValue("SHORT")]
            _SHORT,

            /// <summary>
            /// <para>Long (large integer)</para>
            /// <para>Long (large integer)— Whole numbers between -2,147,483,648 and 2,147,483,647.</para>
            /// <para>长整数（大整数）— 介于 -2,147,483,648 和 2,147,483,647 之间的整数。</para>
            /// </summary>
            [Description("Long (large integer)")]
            [GPEnumValue("LONG")]
            _LONG,

            /// <summary>
            /// <para>Date</para>
            /// <para>Date—Date and/or time.</para>
            /// <para>日期 - 日期和/或时间。</para>
            /// </summary>
            [Description("Date")]
            [GPEnumValue("DATE")]
            _DATE,

            /// <summary>
            /// <para>Blob (binary data)</para>
            /// <para>Blob (binary data)—Long sequence of binary numbers. You need a custom loader or viewer or a third-party application to load items into a BLOB field or view the contents of a BLOB field.</para>
            /// <para>Blob（二进制数据）- 二进制数的长序列。您需要自定义加载程序或查看器或第三方应用程序才能将项目加载到 BLOB 字段或查看 BLOB 字段的内容。</para>
            /// </summary>
            [Description("Blob (binary data)")]
            [GPEnumValue("BLOB")]
            _BLOB,

            /// <summary>
            /// <para>Raster imagery</para>
            /// <para>Raster imagery—Raster images. All ArcGIS software-supported raster dataset formats can be stored, but it is highly recommended that only small images be used.</para>
            /// <para>栅格影像 - 栅格影像。可以存储所有 ArcGIS 软件支持的栅格数据集格式，但强烈建议仅使用小型影像。</para>
            /// </summary>
            [Description("Raster imagery")]
            [GPEnumValue("RASTER")]
            _RASTER,

            /// <summary>
            /// <para>GUID (globally unique identifier)</para>
            /// <para>GUID (globally unique identifier)—Globally unique identifier.</para>
            /// <para>GUID（全局唯一标识符）- 全局唯一标识符。</para>
            /// </summary>
            [Description("GUID (globally unique identifier)")]
            [GPEnumValue("GUID")]
            _GUID,

        }

        /// <summary>
        /// <para>Field Precision</para>
        /// <para><xdoc>
        ///   <para>The number of digits that can be stored in the field. All digits are counted regardless of which side of the decimal they are on.</para>
        ///   <para>If the input table is a file geodatabase, the field precision value will be ignored.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>字段中可以存储的位数。所有数字都被计算在内，无论它们位于小数点的哪一边。</para>
        ///   <para>如果输入表是文件地理数据库，则将忽略字段精度值。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Field Precision")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long? _field_precision { get; set; } = null;


        /// <summary>
        /// <para>Field Scale</para>
        /// <para><xdoc>
        ///   <para>The number of decimal places stored in a field. This parameter is only used in float and double data field types.</para>
        ///   <para>If the input table is a file geodatabase, the field scale value will be ignored.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>存储在字段中的小数位数。此参数仅用于浮点数和双精度数据字段类型。</para>
        ///   <para>如果输入表是文件地理数据库，则将忽略字段比例值。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Field Scale")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long? _field_scale { get; set; } = null;


        /// <summary>
        /// <para>Field Length</para>
        /// <para>The length of the field being added. This sets the maximum number of allowable characters for each record of the field. This parameter is only applicable to fields of type text.</para>
        /// <para>要添加的字段的长度。这将设置字段每条记录允许的最大字符数。此参数仅适用于文本类型的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Field Length")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long? _field_length { get; set; } = null;


        /// <summary>
        /// <para>Field Alias</para>
        /// <para>The alternate name given to the field name. This name is used to describe cryptic field names. This parameter only applies to geodatabases.</para>
        /// <para>字段名称的备用名称。此名称用于描述隐晦的字段名称。此参数仅适用于地理数据库。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Field Alias")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _field_alias { get; set; } = null;


        /// <summary>
        /// <para>Field IsNullable</para>
        /// <para><xdoc>
        ///   <para>Specifies whether the field can contain null values. Null values are different from zero or empty fields and are only supported for fields in a geodatabase.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—The field will allow null values. This is the default.</bullet_item><para/>
        ///     <bullet_item>Unchecked—The field will not allow null values.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定字段是否可以包含 null 值。空值不同于零字段或空字段，并且仅对地理数据库中的字段支持。</para>
        ///   <bulletList>
        ///     <bullet_item>选中 - 该字段将允许空值。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>未选中 - 该字段不允许空值。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Field IsNullable")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _field_is_nullable_value _field_is_nullable { get; set; } = _field_is_nullable_value._true;

        public enum _field_is_nullable_value
        {
            /// <summary>
            /// <para>NULLABLE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NULLABLE")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>NON_NULLABLE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NON_NULLABLE")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Field IsRequired</para>
        /// <para><xdoc>
        ///   <para>Specifies whether the field being created is a required field for the table. Required fields are only supported in a geodatabase.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—The field is a required field. Required fields are permanent and cannot be deleted.</bullet_item><para/>
        ///     <bullet_item>Unchecked—The field is not a required field. This is the default.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定正在创建的字段是否为表的必填字段。必填字段仅在地理数据库中受支持。</para>
        ///   <bulletList>
        ///     <bullet_item>选中 - 该字段为必填字段。必填字段是永久的，无法删除。</bullet_item><para/>
        ///     <bullet_item>未选中 - 该字段不是必填字段。这是默认设置。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Field IsRequired")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _field_is_required_value _field_is_required { get; set; } = _field_is_required_value._false;

        public enum _field_is_required_value
        {
            /// <summary>
            /// <para>REQUIRED</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("REQUIRED")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>NON_REQUIRED</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NON_REQUIRED")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Field Domain</para>
        /// <para>Constrains the values allowed in any particular attribute for a table, feature class, or subtype in a geodatabase. You must specify the name of an existing domain for it to be applied to the field.</para>
        /// <para>约束地理数据库中表、要素类或子类型的任何特定属性中允许的值。您必须指定现有域的名称，才能将其应用于该字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Field Domain")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _field_domain { get; set; } = null;


        /// <summary>
        /// <para>Updated Input Table</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Updated Input Table")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _out_table { get; set; }


        public AddField SetEnv(object workspace = null)
        {
            base.SetEnv(workspace: workspace);
            return this;
        }

    }

}